import React from 'react'
// import { useParams, useSearchParams } from 'react-router-dom'
import { useParams } from 'react-router-dom'

export default function NewDetails() {
  // Params 参数的获取方式
  let p = useParams()
  console.log('useParams', p);
  let obj = {
    id: p.id,
    title: p.title,
    content: p.content
  }

  // search 参数的获取方式
  // let q = useSearchParams()
  // console.log('useSearchParams', q[0].get('id'));
  // let obj = {
  //     id: q[0].get('id'),
  //     title: q[0].get('title'),
  //     content: q[0].get('content')
  // }

  return (
    <>
      <div>NewDetails</div>
      <ul>
        <li>id: {obj.id}</li>
        <li>title: {obj.title}</li>
        <li>content: {obj.content}</li>
      </ul>
    </>
  )
}
